package com.aijk.web.admin.controller;

import com.aijk.commons.web.constant.DubboVersionBasConstant;
import com.aijk.pe.basic.api.BasRegionApi;
import com.aijk.pe.basic.model.qo.BasRegionQo;
import com.aijk.pe.basic.model.vo.BasRegionVo;
import com.aijk.web.admin.RetMsg;
import com.alibaba.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;
import java.util.List;

@Controller
@RequestMapping(value = "admin/bas/region")
public class RegionController extends BaseController {

	protected Logger logger = LoggerFactory.getLogger(this.getClass());

	@Reference(version = DubboVersionBasConstant.DUBBO_VERSION_BAS_REGION_API)
	private BasRegionApi basRegionApi;

	@RequestMapping(value = "/list", method = RequestMethod.POST)
	@ResponseBody
	public RetMsg list(@Valid BasRegionQo basRegionQo) {
		List<BasRegionVo> basRegionVos = basRegionApi.listBasRegion(basRegionQo);
		RetMsg retMsg = RetMsg.success();
		retMsg.put("data", basRegionVos);
		return retMsg;
	}
}
